Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): use CSS layer to let user customize app - WF-57 #710

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

madeindjs
Copy link
Collaborator

@madeindjs madeindjs commented Dec 24, 2024

We want the user to be able to customize any style using import_stylesheet feature. But, actually, he needs to use !important everywhere to make his rules have more weight.

The solution is to use CSS cascade layers to redefine the priority of rules easily. We can move all Writer Framework CSS into a layer wf. This makes other CSS rules have more priority by default.

So I just installed PostCSS and a plugin postcss-assign-layer. This automates surrounding our styles by layers.

Example

/* static/custom.css */
.custom { background: red; }
# main.py
# ...
initial_state.import_stylesheet("theme", "/static/custom.css")

image

@madeindjs madeindjs self-assigned this Dec 24, 2024
We want the user to be able to customize any style using
`import_stylesheet` feature. But, actually, he needs to use `!important`
everywhere to makes his rules have more weight.

The solution is to use CSS cascade layers to redefine the priority of
rules easily. We can move all Writer Framework CSS into a layer `wf`.
This makes other CSS rules have more priority by default.

So I just installed PostCSS and a plugin `postcss-assign-layer`. This
automates surrounding our styles by layers.
@madeindjs madeindjs marked this pull request as ready for review December 24, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant